package com.sw.model;

import java.util.HashMap;
import java.util.Map;

import com.sw.util.ReqParam;

public class Point {
    private double x;
    private double y;
    private String user;
    private double speed;
    private double fuel;
    private Map<String, Double> values;
    private Integer zoom;
    private double lon;
    private double lat;

    public Point(Map<String, String[]> reqValues) {
        this.values = new HashMap<String, Double>();
        try {
            this.user = reqValues.get(ReqParam.USER.value())[0];
            this.x = Double.valueOf(reqValues.get(ReqParam.LAT.value())[0]);
            this.y = Double.valueOf(reqValues.get(ReqParam.LON.value())[0]);
            this.speed = Double
                    .valueOf(reqValues.get(ReqParam.SPEED.value())[0]);
            this.values.put(ReqParam.SPEED.value(), speed);
        } catch (Exception e) {
            System.err.println("Point(,) exception : " + e);
            e.printStackTrace();
        }
    }

    public Point(String user, Double lat, Double lon, Double speed, Double fuel) {
        this.user = user;
        this.x = lat;
        this.y = lon;
        this.speed = speed;
        this.fuel = fuel;
        values = new HashMap<>();
        values.put(ReqParam.SPEED.value(), speed);
//        values.put(ReqParam.FUEL.value(), fuel);
    }

    public double getX() {
        return x;
    }

    public double getY() {
        return y;
    }

    public String getUser() {
        return user;
    }

    public Map<String, Double> getValues() {
        return values;
    }



    public String toString() {
        return user + "," + x + "," + y + "," + speed;
    }

    public double getSpeed() {
        return speed;
    }

    public void setSpeed(double speed) {
        this.speed = speed;
    }

    public Integer getZoom() {
        return zoom;
    }

    public void setZoom(Integer zoom) {
        this.zoom = zoom;
    }

    public double getLon() {
        return lon;
    }

    public void setLon(double lon) {
        this.lon = lon;
    }

    public double getLat() {
        return lat;
    }

    public void setLat(double lat) {
        this.lat = lat;
    }
}
